#include <irrlicht.h>
#include <iostream>
#include "game.h"

using namespace std;
using namespace irr;
using namespace videoGame;

#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif

int main()
{
	// let user select driver type

	//video::E_DRIVER_TYPE driverType;
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;

//### uncomment this for driver options
//	printf("Please select the driver you want for this example:\n"\
//		" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
//		" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
//		" (f) NullDevice\n (otherKey) exit\n\n");

	char i;
	bool fullscreen = false;
	bool music = true;
	bool shadows = true;
	bool additive = false;
	bool vsync = false;
	gameState State = LOADING;

	//	enum gameState {LOADING,
	//	DOUBLE_PEND,
	//	STAGE_ONE,
	//	DONE}


//	std::cin >> i; ### uncomment this for driver options
//
//	switch(i)
//	{
//		case 'a': driverType = video::EDT_DIRECT3D9;break;
//		case 'b': driverType = video::EDT_DIRECT3D8;break;
//		case 'c': driverType = video::EDT_OPENGL;   break;
//		case 'd': driverType = video::EDT_SOFTWARE; break;
//		case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
//		case 'f': driverType = video::EDT_NULL;     break;
//		default: return 0;
//	}

// For testing
	  // gameEngine game(fullscreen, music, shadows, additive, vsync, driverType);
	gameEngine* game = new gameEngine(fullscreen, music, shadows, additive, vsync, driverType);

	while (State != DONE)
	   {

	switch (State)
	  {
	  case LOADING:

	    	State = game->loadScreen();
		delete game;

	    break;

	  case DOUBLE_PEND:
		//gameEngine game(fullscreen, music, shadows, additive, vsync, driverType);
	    sleep(1);
		gameEngine* game = new gameEngine(fullscreen, music, shadows, additive, vsync, driverType);
	    	State = game->run(); //Constructor
		delete game;

	    break;
	  }
	cout<<"Shutting Down"<<endl;

	    }

return 0 ;
};

